package com.wty.gw.service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.wty.gw.util.PageParamReq;
import com.wty.gw.dao.CompanyMapper;
import com.wty.gw.model.Do.CompanyDO;
import com.wty.gw.model.query.CompanyQuery;
import com.wty.gw.service.CompanyService;
import com.wty.gw.model.vo.CompanyVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;

@Service
public class CompanyServiceImpl implements CompanyService{

	@Autowired
    private CompanyMapper companyMapper;

    @Override
    public void add(CompanyDO companyDo) {
        companyMapper.insert(companyDo);
    }

    @Override
    public void delete(Long id) {
        companyMapper.deleteByPrimaryKey(id);
    }

    @Override
    public void update(CompanyDO companyDo) {
        companyMapper.updateByPrimaryKeySelective(companyDo);
    }

    @Override
    public PageInfo<CompanyVo> listByPage(CompanyQuery companyQuery) {
        PageHelper.startPage(companyQuery.getPageNo(), companyQuery.getPageSize());

        return new PageInfo(companyMapper.listBycompanyId(companyQuery));
    }

    @Override
    public CompanyDO get(Long id) {
        return companyMapper.selectByPrimaryKey(id);
    }
	
	
	
	
	
	
}